﻿using Microsoft.Extensions.DependencyInjection;
using StartsEAS_API.BLL.Interfaces.IEArrangeB;
using StartsEAS_API.DAL.EArrangeD;
using StartsEAS_API.Model;
using StartsEAS_API.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StartsEAS_API.BLL.EArrangeB
{
    public class EArrangeBLL : IEArrangeBLL
    {
        private readonly StarsEASContext _context;
        public EArrangeDAL _eArrangeDal;

        public EArrangeBLL(IServiceScopeFactory context)
        {
            _context = context.CreateScope().ServiceProvider.GetRequiredService<StarsEASContext>();
            _eArrangeDal = new(_context);
        }

        public ResultUtils addEArrange(string token, Earrange data)
        {
            return _eArrangeDal.addEArrange(token, data);
        }

        public ResultUtils GetAllEArrange()
        {
            return _eArrangeDal.GetAllEArrange();
        }

        public ResultUtils GetEArrangesByToken(string token, string classId)
        {
            return _eArrangeDal.GetEArrangesByToken(token, classId);
        }

        public ResultUtils updateEArrange(string token, Earrange data)
        {
            return _eArrangeDal.updateEArrange(token, data);
        }
    }
}
